]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Turn on -Werror and -Wmissing-prototypes
authorOwen W. Taylor <otaylor@fishsoup.net>
Thu, 6 Aug 2009 20:26:45 +0000 (16:26 -0400)
committerOwen W. Taylor <otaylor@fishsoup.net>
Thu, 6 Aug 2009 20:46:55 +0000 (16:46 -0400)
When compiling with GCC turn on -Wmissing-prototypes, and by default
turn on -Werror as well.

As with most gnome modules:

 --enable-compile-warnings=minimum/maximum

Can be used to disable -Werror (they are the same)

http://bugzilla.gnome.org/show_bug.cgi?id=590998

configure.ac

index 571297a7bbdd848b7caa290ba47ef465360d12bc..ef64a230f074f85f7e9275110d968de5fe5a1faf 100644 (file)
@@ -80,17 +80,31 @@ AC_SUBST(GIRDIR)
 TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
 AC_SUBST(TYPELIBDIR)
 
+# Stay command-line compatible with the gnome-common configure option. Here
+# minimum/yes/maximum are the same, however.
+AC_ARG_ENABLE(compile_warnings,
+  AC_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
+                 [Turn on compiler warnings]),,
+  enable_compile_warnings=error)
+
 changequote(,)dnl
-if test "x$GCC" = "xyes"; then
-  case " $CFLAGS " in
-  *[\ \        ]-Wall[\ \      ]*) ;;
-  *) CFLAGS="$CFLAGS -Wall" ;;
-  esac
-
-  case " $OBJCFLAGS " in
-  *[\ \        ]-Wall[\ \      ]*) ;;
-  *) OBJCFLAGS="$OBJCFLAGS -Wall" ;;
-  esac
+if test "$enable_compile_warnings" != no ; then
+  if test "x$GCC" = "xyes"; then
+    case " $CFLAGS " in
+    *[\ \      ]-Wall[\ \      ]*) ;;
+    *) CFLAGS="$CFLAGS -Wall" ;;
+    esac
+    case " $CFLAGS " in
+    *[\ \      ]-Wmissing-prototypes[\ \       ]*) ;;
+    *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
+    esac
+    if test "$enable_compile_warnings" = error ; then
+      case " $CFLAGS " in
+      *[\ \    ]-Werror[\ \    ]*) ;;
+      *) CFLAGS="$CFLAGS -Werror" ;;
+      esac
+    fi
+  fi
 fi
 changequote([,])dnl